/*
 * hkh-project
 * leafteamwork.blogspot.com
 * Tool: Netbeans 6.7.1 - SQL Server 2005
 */
package vn.com.hkh.service;

import java.util.Collection;
import vn.com.hkh.dao.ContactDAO;
import vn.com.hkh.dto.ContactDTO;

/**
 *
 * @author leaf
 */
public class ContactService {

    ContactDAO contactDAO = new ContactDAO();

    /**
     * Create new Contact
     * @param _dto
     * @return
     */
    public ContactDTO create(ContactDTO _dto) {
        return contactDAO.create(_dto);
    }

    /**
     * Update Contact
     * @param _dto
     * @return
     */
    public ContactDTO store(ContactDTO _dto) {
        return contactDAO.update(_dto);
    }

    /**
     * Read by All Contact
     * @return
     */
    public Collection<ContactDTO> findContacts() {
        return contactDAO.readByAll();
    }

    public ContactDTO findByPrimarykey(String _pk) {
        return contactDAO.readByID(_pk);
    }

    /**
     * Delete contact
     * @param _id
     * @return
     */
    public boolean remove(String _id) {
        return contactDAO.deleteById(_id);
    }
}
